<template>
  <div class="com-page-list">
    <w-nav-bar
      v-if="navTitle"
      :title="navTitle"/>
    <w-cell
      v-for="(v, k) in loadListModel.dataArr"
      :link="linkKey ? v[linkKey] : null"
      :key="k"
      :icon="v[iconKey]"
      :header="v[headerKey]"
      :detail="v[detailKey]"
      :time="v[timeKey]"
      @click="$router.push({name: pathName, query: {id: v._id }})"/>
    <w-load-more :load-model="loadListModel"/>
  </div>
</template>

<script>
  import WCell from '@/components/mobile/cell/index'
  import YBListLoad from '@/models/YBListLoad.js'
  import WLoadMore from '@/components/global/loadMore'
  export default {
    name: 'ComList',
    components: {
      WCell,
      WLoadMore
    },
    props: {
      classModel: {
        type: Function,
        default: () => {}
      },
      pathName: {
        type: String,
        default: ''
      },
      iconKey: {
        type: String,
        default: ''
      },
      headerKey: {
        type: String,
        default: ''
      },
      detailKey: {
        type: String,
        default: ''
      },
      timeKey: {
        type: String,
        default: ''
      },
      linkKey: {
        type: String,
        default: ''
      },
      /**
       * 导航栏标题
       */
      navTitle: {
        type: String,
        default: ''
      }
    },
    data () {
      return {
        /**
         * 列表加载模型
         */
        loadListModel: null
      }
    },
    created() {
      const otherP = {}
      if (this.$route.params.type) {
        otherP.type = this.$route.params.type
      }
      this.loadListModel = new YBListLoad(this.classModel, otherP)
    }
  }
</script>

<style lang="scss" scoped>
</style>
